package org.linlinjava.litemall.admin.config;

import lombok.Data;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.springframework.stereotype.Component;
import java.io.Serializable;

@Component
@Data
public class AdminMobOremailToken extends UsernamePasswordToken implements Serializable {


    private static final long serialVersionUID = 6293390033867929958L;
    // 手机号码
    private String mobOremail;

    private String authCode;



    //无参构造
    public AdminMobOremailToken(){}

    //获取存入的值
    @Override
    public Object getPrincipal() {
        if (mobOremail == null) {
            return getUsername();
        } else {
            return getMobOremail();
        }
    }

    @Override
    public Object getCredentials() {
        if (mobOremail == null) {
            return getPassword();
        }else {
            return "ok";
        }

    }

    public AdminMobOremailToken(String mobOremail) {
        this.mobOremail = mobOremail;
    }


   /* public AdminMobOremailToken(String mobOremail,String authCode) {
        this.mobOremail = mobOremail;
        this.authCode = authCode;

    }*/

    public AdminMobOremailToken(final String userName, final String password) {
        super(userName, password);
    }



}
